import { InventoryCategory, ItemBase } from './ItemTypes';

const FORBIDDEN: InventoryCategory[] = ['weapon', 'gear'];

export enum SafeBoxRejectionReason {
  EquipmentNotAllowed = '装备类无法存入保险箱',
}

export class SafeBoxRules {
  static canStore(item: ItemBase): boolean {
    return !FORBIDDEN.includes(item.category);
  }

  static canDeposit(item: ItemBase): boolean {
    return SafeBoxRules.canStore(item);
  }

  static rejectionReason(item: ItemBase): string | null {
    return SafeBoxRules.canStore(item) ? null : SafeBoxRejectionReason.EquipmentNotAllowed;
  }
}

export default {
  SafeBoxRules,
  SafeBoxRejectionReason,
};
